package com.guang.springbootrequestversion.config;

import com.guang.springbootrequestversion.bean1.Bird;
import com.guang.springbootrequestversion.bean1.Dog;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author liguang
 * @date 2022/5/10 11:39
 */
@Configuration
// 当容器中没有的时候，下面的才会生效
@ConditionalOnMissingClass(value = {"dog","bird"})
public class MyConfig2 {

    @Bean
    public Bird bird(){
        return new Bird();
    }

    // @ConditionalOnClass(name = "bird")
//    @ConditionalOnClass(value = Bird.class)
//    @Bean
//    public Dog dog(){
//        return new Dog();
//    }

    @Bean
    public Dog dog(){
        return new Dog();
    }
}
